#coding=utf-8
__author__ = 'chutf'
__date__ = '2020/3/21 22:55'
from django import forms
from captcha.fields import CaptchaField
from .models import UserProfile


class LoginForm(forms.Form):
    username=forms.CharField(required=True,max_length=20)
    password=forms.CharField(required=True,min_length=8)


class RegisterForm(forms.Form):
    email = forms.EmailField(required=True, max_length=30)
    password = forms.CharField(required=True, min_length=8)
    captcha=CaptchaField(error_messages={"invalid":"错误验证码，请重新输入"})


class ForgetForm(forms.Form):
    email = forms.EmailField(required=True, max_length=30)
    captcha=CaptchaField(error_messages={"invalid":"错误验证码，请重新输入"})


class ModifyPwdForm(forms.Form):
    password1 = forms.CharField(required=True, min_length=8)
    password2 = forms.CharField(required=True, min_length=8)


class ImageUploadForm(forms.ModelForm):
    class Meta:
        model=UserProfile
        fields=["image"]


class UserInfoForm(forms.ModelForm):
    class Meta:
        model=UserProfile
        fields=["nick_name","birday","gender","address","mobile"]